<if condition="(is_login()) ">
    <div class="friend_panel visible-md visible-lg" style="display: none">
        <a class="btn-pull" onclick="$('#right_panel_main').toggle();"><i class="glyphicon glyphicon-chevron-left"></i>&nbsp;
        </a>
        <php>
            $currentSession=D('Common/Talk')->getCurrentSessions();
        </php>

        <div id="right_panel_main"  <if condition="count($currentSession) eq 0">style="display: none"</if>>
            <!--开始会话板-->

            <div id="session_panel_main" >
            <h2>会话<!--( {:count($currentSession)} )--></h2>

            <div id="scrollArea_session" class="row ">
                <div id="scrollContainer_session">
                    <ul class="friend_list">
                        <volist name="currentSession" id="session">
                            <li id="chat_li_{$session.id}" >
                                <div class="row">
                                    <div class="col-md-6">
                                        <a title=" {$session.title|op_t}" onclick="open_chat_box({$session.id})">
                                            <img src="{$session.first_user.avatar64}" class="avatar-img" style="width: 45px;">
                                            <eq name="session.new" value="1">
                                                <span class="badge_new">&nbsp;</span>
                                            </eq>
                                        </a>
                                    </div>
                                    <div class="col-md-6">
                                        <div>
                                            <a class="text-more" style="width: 100%" target="_blank" title="{$session.title|op_t}">
                                                {$session.title}
                                            </a>
                                        </div>
                                        <div>
                                            <a onclick="chat_exit({$session.id})"><i style="color: red" title="退出会话" class="glyphicon glyphicon-off"></i></a>
                                        </div>
                                    </div>
                                </div>

                            </li>

                        </volist>
                    </ul>
                </div>
            </div>
            <div class="session_more">
                <a title="会话面板" onclick="$('#friend_panel_main').toggle();$('#session_panel_main').toggle()"
                   class="btn_session_more col-md-6 active"><i class="glyphicon glyphicon-send"></i>
                </a>
                <a title="好友面板" onclick="$('#friend_panel_main').toggle();$('#session_panel_main').toggle()"
                   class="btn_session_more col-md-6"><i class="glyphicon glyphicon-user"></i>
                </a>
            </div>

            <script>
                $('#scrollArea_session').slimScroll({
                    height: '430px',
                    alwaysVisible: true,
                    start: 'bottom'
                });
                var last_toast_talk_message_time="{:time()}";//最后提示会话消息的时间
            </script>
            <!--结束会话版-->
        </div>

        <!--开始好友板-->
        <div id="friend_panel_main" style="display: none">
            <php>
                $friends=D('Common/Follow')->getAllFriends();
            </php>
            <h2>好友( {:count($friends)} )</h2>

            <div id="scrollArea_friend" class="row ">
                <div id="scrollContainer_friend">
                    <ul class="friend_list">
                        <volist name="friends" id="friend">
                            <php>
                                $friend=query_user(array('avatar64','username','space_url','uid'),$friend['follow_who'])
                            </php>
                            <li id="friends_li_{$friend.id}">
                                <div class="row">
                                    <div class="col-md-6">
                                        <a target="_blank" title=" {$friend.username|op_t}"
                                           href="{$friend.space_url}">
                                            <img src="{$friend.avatar64}" class="avatar-img" style="width: 45px;">
                                        </a>
                                    </div>
                                    <div class="col-md-6">
                                        <div>
                                            <a class="text-center" style="width: 100%" target="_blank" title=" {$friend.username|op_t}"
                                               href="{$friend.space_url}">
                                                {$friend.username}
                                            </a>
                                        </div>
                                        <div>
                                            <a onclick="start_talk({$friend.uid})"><i title="发起新会话" class="glyphicon glyphicon-send"></i></a>
                                        </div>
                                    </div>
                                </div>

                            </li>
                        </volist>
                    </ul>
                </div>
            </div>
            <script>
                $('#scrollArea_friend').slimScroll({
                    height: '430px',
                    alwaysVisible: true,
                    start: 'bottom'
                });
            </script>

            <div class="session_more">
                <a title="会话面板" onclick="$('#friend_panel_main').toggle();$('#session_panel_main').toggle()"
                   class="btn_session_more col-md-6"><i class="glyphicon glyphicon-send"></i>
                </a>
                <a title="好友面板" onclick="$('#friend_panel_main').toggle();$('#session_panel_main').toggle()"
                   class="btn_session_more col-md-6 active"><i class="glyphicon glyphicon-user"></i>
                </a>
            </div>
        </div>
        <!--结束会话版-->


    </div>


    </div>


    </div>
    <div id="chat_box" style="display: none" class="chat_panel">
        <div class="panel_title"><img id="chat_ico" class="chat_avatar avatar-img" src="{$friend.avatar64}">

            <div id="chat_title" class="title pull-left text-more"></div>
            <div class="control_btns pull-right"><a><i onclick="$('#chat_box').hide();"
                                                       class="glyphicon glyphicon-minus"></i></a><!-- <a
                ><i class="glyphicon glyphicon-off"></i></a>--></div>
        </div>
        <div class="row talk-body ">
            <div id="scrollArea_chat" class="row ">
                <div id="scrollContainer_chat">
                </div>
            </div>

        </div>

        <div class="send_box">
            <input id="chat_id" type="hidden" value="0">
            <script>
                var myhead = "{$self.avatar128}";
            </script>
            <textarea id="chat_content" class="form-control"></textarea>
        </div>
        <div class="row">
            <div class="col-md-6">
                <button class=" btn btn-danger" onclick="chat_exit()"
                        style="margin: 10px 10px" title="退出会话"><i class="glyphicon glyphicon-off"></i>
                </button>
              <!--  <button class=" btn btn-success" onclick="chat_exit()"
                        style="margin: 10px 10px" title="邀请好友"><i class="glyphicon glyphicon-plus"></i>
                </button>-->

            </div>
            <div class="col-md-6">
                <button class="pull-right btn btn-primary" onclick="chat_postMessage()"
                        style="margin: 10px 10px"> 发送 Ctrl+Enter
                </button>
            </div>
        </div>
    </div>
</if>